<?php
namespace library\widgets;

use idea\mvc\Widget;

/**
 * Tips class file
 * 页面提示信息
 * @author 宋欢 <iphper@yeah.net>
 * @version $Id: Tips.php 1 2013-04-20 17:11:06Z huan.song $
 * @package library.widgets
 * @since 1.0
 */
class Tips extends Widget
{
	/**
	 * 执行Widget类，输出内容
	 * @return void
	 */
	public function run()
	{
		$errNo = $this->getView()->err_no;
		$errMsg = $this->getView()->err_msg;
		
		$display = ($errMsg == "") ? "none" : "block"; 
		$className = $errNo > 0 ? 'error' : 'success';
		echo '<div id="tips" class="alert ' . $className . '" style="display: ' . $display . '">' . $errMsg . '</div>';
	}
}
